package com.maimao.auth.client;

import com.maimao.auth.client.fallback.SysUserFallBackFactory;
import com.maimao.auth.client.fallback.UserFallBackFactory;
import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.model.user.sys.vo.Permissions;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author MaoLin Wang
 * @date 2020/11/30 9:45 下午
 */
@FeignClient(contextId = "userClient", value = ServiceContainer.USER_SERVICE, fallbackFactory = UserFallBackFactory.class, configuration = FeignInterceptor.class)
@RequestMapping("/web/member")
public interface UserClient {

    /**
     * 根据用户名查询会员权限
     */
    @GetMapping("/permissions-g/uname")
    Result<Permissions> getMemberPermissionByUsername(@RequestParam("username") String username);

    /**
     * 根据手机号查询会员权限
     */
    @GetMapping("/permissions-g/mobile")
    Result<Permissions> getMemberPermissionByMobile(@RequestParam("mobile") String mobile);

    /**
     * 根据邮箱查询会员权限
     */
    @GetMapping("/permissions-g/email")
    Result<Permissions> getMemberPermissionByEmail(@RequestParam("email") String email);

}